package com.bleeth.fx.view.demo5;

import com.bleeth.fx.helper.SStyleHelper;
import com.bleeth.fx.layout.FormBuilder;
import com.bleeth.fx.layout.GirdCell;
import com.bleeth.fx.meta.IForm;
import com.bleeth.fx.meta.View;
import com.bleeth.fx.meta.ViewRouter;
import javafx.beans.property.Property;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;

/**
 * @author Sakura
 * @version 1.0
 * @date 2021-11-13 22:17
 **/
@View(value = "main", type = "begin")
public class MainView implements IForm {


    @Override
    public Region make(Property... properties) {
        Region leftView = ViewRouter.builder().style((node) -> leftViewStyle(node)).push("left");
        VBox main = FormBuilder.form(1300D, 800D)
                .coverRow(GirdCell.createCell(300D, Pos.CENTER),
                        GirdCell.createCell(1000D, Pos.CENTER))
                .coverCell(0, leftView)
                .endRow(false)
                .build();

        return main;
    }

    @Override
    public void css() {

    }

    public void leftViewStyle(Node node) {
        SStyleHelper.node(node)
                .addStyle("-fx-border-color", "#f4f4f422")
                .addStyle("-fx-border-width", "2")
                .apply();
    }

}
